using System;
using System.Windows.Forms;
using Spring.Windows.Forms;

namespace SpringSeries.Core.ValidationWinForm
{
    public partial class PersonEditForm : ValidatingForm {
        private Person _person = new Person();

        protected override void OnLoad(EventArgs e) {
            personBindingSource.DataSource = _person;
            base.OnLoad(e);
        }

        public PersonEditForm() {
            InitializeComponent();
        }

        protected override object GetFormBackingObject() {
            return _person;
        }

        private void btnCancel_Click(object sender, EventArgs e) {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void btnOk_Click(object sender, EventArgs e) {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}